package com.zz.ecommerce.declareManage.importB2CDeclareDirect.waybillInsp;

import com.zz.ecommerce.common.GridRequest;
import com.zz.ecommerce.common.GridResult;
import com.zz.ecommerce.common.bean.insp.db.waybill.TBillHeadInsp;
import com.zz.ecommerce.common.constants.CommonConstant;
import com.zz.ecommerce.common.constants.DictConstants;
import com.zz.ecommerce.common.constants.TableConstants;
import com.zz.ecommerce.declareManage.common.dao.TBillHeadInspDao;
import com.zz.ecommerce.utils.SessionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * Created by fanshilei on 2016/3/28.
 * <p/>
 * 进口B2C申报服务（直购）--运单管理
 */
@Controller
@RequestMapping("/importB2CDirect/waybillInsp")
@Scope("prototype")
public class InspDirectWaybillController {

    @Autowired
    private TBillHeadInspDao tBillHeadInspDao;

    /**
     * 运单管理初始页
     *
     * @return
     */
    @RequestMapping(value = "init", method = {RequestMethod.GET})
    public String init() {
        return "declareManage/importB2CDeclareDirect/waybillInsp/waybill";
    }

    /**
     * 运单列表页查询List
     *
     * @param tBillHeadInsp
     * @param request
     * @return
     */
    @RequestMapping("/queryTWaybillHeadInspList")
    @ResponseBody
    public GridResult queryTWaybillHeadQdcList(TBillHeadInsp tBillHeadInsp, GridRequest request, HttpSession session) {
        tBillHeadInsp.setOrgId(SessionUtil.getOrganizationId(session));
        tBillHeadInsp.setIetype(DictConstants.IMPORT);
        tBillHeadInsp.setBiztype(CommonConstant.BIZ_TYPE_DIRECT);
        return new GridResult(tBillHeadInspDao.page(TableConstants.T_BILL_HEAD_INSP, tBillHeadInsp, request.getStart(), request.getEnd(), request.getSortOrder()), request, tBillHeadInspDao.count(TableConstants.T_BILL_HEAD_INSP, tBillHeadInsp));
    }

}
